package com.kh.pajx.sop.service.impl;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import com.kh.pajx.sop.base.BaseServiceImpl;
import com.kh.pajx.sop.dao.ISysPosDebugDao;
import com.kh.pajx.sop.domain.PageBean;
import com.kh.pajx.sop.domain.SysPosDebug;
import com.kh.pajx.sop.service.ISysSopDebugService;
import com.kh.pajx.sop.util.page.QueryHelper;
import com.kh.pajx.sop.util.page.QueryHelperForManyTable;
@Service
public class SysSopDebugServiceImpl extends BaseServiceImpl<SysPosDebug>
		implements ISysSopDebugService {

	@Resource
	private ISysPosDebugDao sysPosDebugDao;
	

	@Override
	public List<List<String>> getDebugMes(Map<String, String> params,int pageSize,int pageNum) {
		// TODO Auto-generated method stub
		return sysPosDebugDao.getDebugMes(params, pageSize, pageNum);
	}


	@Override
	public Map<String, List<String>> getAllGra(String sclId) {
		Map<String,List<String>> grades = new HashMap<String,List<String>>();
		List<List<String>> list = sysPosDebugDao.getAllGrade(sclId);
		for (List<String> list2 : list) {
			grades.put(list2.get(0), list2);
		}
		return grades;
	}


	@Override
	public Map<String, List<String>> getAllCLS(String sclId) {
		Map<String,List<String>> cls = new HashMap<String,List<String>>();
		List<List<String>> list = sysPosDebugDao.getAllCls(sclId);
		for (List<String> list2 : list) {
			cls.put(list2.get(0), list2);
		}
		return cls;
	}


	@Override
	public Map<String, List<String>> getAllDic() {
		Map<String,List<String>> dics = new HashMap<String,List<String>>();
		List<List<String>> list = sysPosDebugDao.getDicMes();
		for (List<String> list2 : list) {
			dics.put(list2.get(0), list2);
		}
		return dics;
	}


	@Override
	public List<List<String>> getAllRecord(Map<String, String> params,
			int pageSize, int pageNum) {
		// TODO Auto-generated method stub
		return sysPosDebugDao.getRecordMes(params, pageSize, pageNum);
	}


	@Override
	public int recordCount(Map<String, String> params) {
		// TODO Auto-generated method stub
		return sysPosDebugDao.recordCount(params);
	}


	@Override
	public int debugCount(Map<String, String> params) {
		// TODO Auto-generated method stub
		return sysPosDebugDao.debugCount(params);
	}


	@Override
	public List<List<String>> getTeaDebugMes(Map<String, String> params,
			int pageSize, int pageNum) {
		// TODO Auto-generated method stub
		return sysPosDebugDao.getTeaDebugMes(params, pageSize, pageNum);
	}


	@Override
	public int teaDebugCount(Map<String, String> params) {
		// TODO Auto-generated method stub
		return sysPosDebugDao.teaDebugCount(params);
	}


	@Override
	public List<List<String>> getTeaRecordMes(Map<String, String> params,
			int pageSize, int pageNum) {
		// TODO Auto-generated method stub
		return sysPosDebugDao.getTeaRecordMes(params, pageSize, pageNum);
	}


	@Override
	public int teaRecordCount(Map<String, String> params) {
		return sysPosDebugDao.teaRecordCount(params);
	}


	@Override
	public List<List<String>> getCmppMess(Map<String, String> params,
			int pageSize, int pageNum) {
		// TODO Auto-generated method stub
		return sysPosDebugDao.getCmppMess(params, pageSize, pageNum);
	}


	@Override
	public int getCmppCounts(Map<String, String> params) {
		// TODO Auto-generated method stub
		return sysPosDebugDao.getCmppCounts(params);
	}


	@Override
	public List<String> getTelRecord(String cardSn,String cardNo) throws SQLException {
		if(StringUtils.isNotBlank(cardSn)){
			return sysPosDebugDao.getTelMessge(cardSn);
		}else{
			if(StringUtils.isNotBlank(cardNo)){
				String cardSns = sysPosDebugDao.getCardSnsByCardNo(cardNo);
					return sysPosDebugDao.getTelMessge(cardSns);
			}
		}
		return null;
	}


	@Override
	public void sclReportMonth() {
		System.out.println("执行一次");
		sysPosDebugDao.sclReportMonth();
	}



}
